/*Author:no-bald-chen
 * Time:2021/8/26
 * */

package Algorithm.sort;

import Utils.Swap;

public class Select_sort {
    public void sort(int[] nums){
        if (nums==null || nums.length==0){
            return;
        }
        for (int i = nums.length-1; i >=0 ; i--) {
            int maxIndex = 0;
            for (int j = 0; j <=i; j++) {
                if (nums[j]>nums[maxIndex]){
                    maxIndex = j;
                }
            }
            Swap.swap(nums,i,maxIndex);
        }
    }
}
